dir_path = r"D:\my_photos\ohos\entry\oh_modules"  # use raw string for paths

import os
import shutil  # required for deleting non-empty directories

try:   
    shutil.rmtree(dir_path)
    print("Directory removed successfully")
except OSError as error:
    print(f"Error: {dir_path} : {error.strerror}")
